home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3 / librw / RWTValVector.z / RWTValVector
Encoding:
Text File  |  1998-10-30  |  6.5 KB  |  199 lines

  1.  
  2.  
  3.  
  4. RRRRWWWWTTTTVVVVaaaallllVVVVeeeeccccttttoooorrrr((((3333CCCC++++++++))))                                          RRRRWWWWTTTTVVVVaaaallllVVVVeeeeccccttttoooorrrr((((3333CCCC++++++++))))
  5.  
  6.  
  7.  
  8. NNNNaaaammmmeeee
  9.      RWTValVector<T> - Rogue Wave library class
  10.  
  11. SSSSyyyynnnnooooppppssssiiiissss
  12.               #include <rw/tvvector.h>
  13.  
  14.  
  15.  
  16.               RWTValVector<T> vec;
  17.  
  18.  
  19.  
  20.  
  21. DDDDeeeessssccccrrrriiiippppttttoooonnnn
  22.      Class RRRRWWWWTTTTVVVVaaaallllVVVVeeeeccccttttoooorrrr<<<<TTTT>>>> is a simple parameterized vector of objects of type
  23.      TTTT.  It is most useful when you know precisely how many objects have to be
  24.      held in the collection.  If the intention is to "insert" an unknown
  25.      number of objects into a collection, then class RRRRWWWWTTTTVVVVaaaallllOOOOrrrrddddeeeerrrreeeeddddVVVVeeeeccccttttoooorrrr<<<<TTTT>>>>
  26.      may be a better choice.  The class TTTT must have:
  27.           well-defined copy semantics (TTTT::::::::TTTT((((ccccoooonnnnsssstttt TTTT&&&&)))) or equiv.);
  28.  
  29.           well-defined assignment semantics (TTTT::::::::ooooppppeeeerrrraaaattttoooorrrr====((((ccccoooonnnnsssstttt TTTT&&&&)))) or
  30.           equiv.);
  31.  
  32.           a default constructor.
  33.  
  34.  
  35. PPPPeeeerrrrssssiiiisssstttteeeennnncccceeee
  36.      Isomorphic
  37.  
  38. EEEExxxxaaaammmmpppplllleeee
  39.               #include <rw/tvvector.h>
  40.           #include <rw/rwdate.h>
  41.           #include <rw/rstream.h>
  42.           main()  {
  43.             RWTValVector<RWDate> week(7);
  44.             RWDate begin;   // Today's date
  45.             for (int i=0; i<7; i++)
  46.               week[i] = begin++;
  47.             for (i=0; i<7; i++)
  48.               cout << week[i] << endl;
  49.             return 0;
  50.           }
  51.  
  52.  
  53.      Program output:
  54.  
  55.               March 16, 1996
  56.           March 17, 1996
  57.           March 18, 1996
  58.           March 19, 1996
  59.           March 20, 1996
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. RRRRWWWWTTTTVVVVaaaallllVVVVeeeeccccttttoooorrrr((((3333CCCC++++++++))))                                          RRRRWWWWTTTTVVVVaaaallllVVVVeeeeccccttttoooorrrr((((3333CCCC++++++++))))
  71.  
  72.  
  73.  
  74.           March 21, 1996
  75.           March 22, 1996
  76.  
  77. PPPPuuuubbbblllliiiicccc CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrrssss
  78.               RRRRWWWWTTTTVVVVaaaallllVVVVeeeeccccttttoooorrrr<<<<TTTT>>>>();
  79.  
  80.  
  81.      Constructs an empty vector of length zero.
  82.  
  83.               RRRRWWWWTTTTVVVVaaaallllVVVVeeeeccccttttoooorrrr<T>(size_t n);
  84.  
  85.  
  86.      Constructs a vector of length nnnn.  The values of the elements will be set
  87.      by the default constructor of class TTTT.  For a built in type this can (and
  88.      probably will) be garbage.
  89.  
  90.               RRRRWWWWTTTTVVVVaaaallllVVVVeeeeccccttttoooorrrr<<<<TTTT>>>>(size_t n, const T& ival);
  91.  
  92.  
  93.      Constructs a vector of length nnnn, with each element initialized to the
  94.      value iiiivvvvaaaallll.
  95.  
  96.               RRRRWWWWTTTTVVVVaaaallllVVVVeeeeccccttttoooorrrr<<<<TTTT>>>>(const RWTValVector& v);
  97.  
  98.  
  99.      Constructs self as a copy of vvvv.  Each element in vvvv will be copied into
  100.      self.
  101.  
  102.               ~~~~RRRRWWWWTTTTVVVVaaaallllVVVVeeeeccccttttoooorrrr<<<<TTTT>>>>();
  103.  
  104.  
  105.      Calls the destructor for every element in self.
  106.  
  107. PPPPuuuubbbblllliiiicccc OOOOppppeeeerrrraaaattttoooorrrrssss
  108.               RWTValVector<T>&
  109.           ooooppppeeeerrrraaaattttoooorrrr====(const RWTValVector<T>& v);
  110.  
  111.  
  112.      Sets self to the same length as vvvv and then copies all elements of vvvv into
  113.      self.
  114.  
  115.               RWTValVector<T>&
  116.           ooooppppeeeerrrraaaattttoooorrrr====(const T& ival);
  117.  
  118.  
  119.      Sets all elements in self to the value iiiivvvvaaaallll.
  120.  
  121.               const T&
  122.           ooooppppeeeerrrraaaattttoooorrrr(((())))(size_t i) const;
  123.           T&
  124.           ooooppppeeeerrrraaaattttoooorrrr(((())))(size_t i);
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. RRRRWWWWTTTTVVVVaaaallllVVVVeeeeccccttttoooorrrr((((3333CCCC++++++++))))                                          RRRRWWWWTTTTVVVVaaaallllVVVVeeeeccccttttoooorrrr((((3333CCCC++++++++))))
  137.  
  138.  
  139.  
  140.      Returns a reference to the iiiith value in the vector.  The index iiii must be
  141.      between 0 and the length of the vector less one.  No bounds checking is
  142.      performed.
  143.  
  144.               const T&
  145.           ooooppppeeeerrrraaaattttoooorrrr[[[[]]]](size_t i) const;
  146.           T&
  147.           ooooppppeeeerrrraaaattttoooorrrr[[[[]]]](size_t i);
  148.  
  149.  
  150.      Returns a reference to the iiiith value in the vector.  The index iiii must be
  151.      between 0 and the length of the vector less one.  Bounds checking will be
  152.      performed.
  153.  
  154. PPPPuuuubbbblllliiiicccc MMMMeeeemmmmbbbbeeeerrrr FFFFuuuunnnnccccttttiiiioooonnnnssss
  155.               const T*
  156.           ddddaaaattttaaaa() const;
  157.  
  158.  
  159.      Returns a pointer to the raw data of self.  Should be used with care.
  160.  
  161.               size_t
  162.           lllleeeennnnggggtttthhhh() const;
  163.  
  164.  
  165.      Returns the length of the vector.
  166.  
  167.               void
  168.           rrrreeeesssshhhhaaaappppeeee(size_t N);
  169.  
  170.  
  171.      Changes the length of the vector to NNNN.  If this results in the vector
  172.      being lengthened, then the initial value of the additional elements is
  173.      set by the default constructor of TTTT.
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.